<?php


	$notification = "";
	
	if(isset($_GET['notification']))
	{
		//$notification =constant($_GET['notification']);
		$notification = constant($_GET['notification']);
	}

	$cItems = new CItems;
	$itemsCount=$cItems->CItemsCount();
	
	if(isset($_GET['page'])){
		$itemsPage=$_GET['page'];
		$arrItems = $cItems->CItemsLimitList($itemsPage);
	}else{
		$itemsPage=0;
		$arrItems = $cItems->CItemsList();
	}
	$count = 0 ;
	if(is_array($arrItems))
	{
		$mainContent = '<form method="get" name="form" action="">
						<div id="content2">
							<span style="font-size:10px;color:#FF0000;font-weight:bold;font-family:Arial, Helvetica, sans-serif">'.$notification.'</span>
							<table border="0" width="98%" style="position:relative;border-collapse:collapse" align = "center">
							<tr>
								<td colspan="6" align="left" valign="middle" height="50px"> 
								<h3>View all Items - page: &nbsp;';
		//paging items list		
		for($p=0;$p<$itemsCount/16;$p++){
			if($p!=$itemsPage){
				$mainContent.='<a href="main.php?jmp=items&to=idbview&page='.$p.'"><u>'.$p.'</u></a>&nbsp;';
			}else{
				$mainContent.='<b>'.$p.'</b>&nbsp;';
			}
		}
		$mainContent.='</h3>
								</td>
							</tr>
							<tr bgcolor="#CCCCCC" height="24">
								<td width="16">#
								</td>
								<td width="16">
									<input type="checkbox" name="checkMaster"  onclick="toggleChecker(this,\'checker\')">
								</td>
								<td width="64" align="center">
									Images
								</td>
								<td width="192" align="center">
									Information
								</td>
								<td width="40%" align="left">
									Description
								</td>
								<td align="center" width="48">	
								</td>
							</tr>';
			foreach ($arrItems as $key => $value)				
			{
				$count ++;
				$mainContent.='<tr>
								<td>'.($count+$itemsPage*16).'
								</td>
								<td>
									<input type="checkbox" name="checker[]" value="'.$value['id'].'" >
								</td>
								<td valign="middle" algin="center">
									<img src=../resources/'.$value['picture'].' class="DLThumbs">
								</td>
								<td valign="top" align="left">
									<div><font color="#ff5a00">'.$value['name'].'</font></div>
									<div><font color="#0062bd"><b>'.$value['manufacture'].'</b></font></div>
									<div>Type: '.$value['id_type'].'</div>	
								</td>
								<td valign="top" align="left">
									
								</td>
								<td>
								<span>
									<a href="main.php?jmp=items&to=idbedi&idbpos='.$value['id'].'"><img src="images/edit.png" width="16px" height="16px" border="0" title="Edit this items"></a>
									<!--<a href="main.php?jmp=items&to=idbdet&idbpos='.$value['id'].'"><img src="images/view.png" width="16px" height="16px" border="0" title="View detail"></a> -->
									<a href="main.php?jmp=items&to=idbdel&idbpos='.$value['id'].'"><img src="images/delete.png" width="16px" height="16px" border="0" title="Delete this items"></a>
								</span>
								</td>
							</tr>';
			}			
			$mainContent.='	<tr>
								<td colspan="5" algin="left">
									<input type="submit" name="btnDel" value ="Delete" id="input2">
									<input type="hidden" name="jmp" value="items">
									<input type="hidden" name="to" value="idbdel">
								</td>
							</tr>
							</table>
					</div>
					</form>
					';
		}



?>